<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt"  prefix="c"%>

<c:choose>
	<c:when test="${not empty errorMessage}">
		<script>
			alert("Error :  ${errorMessage}");
		</script>
	</c:when>
	<c:when test="${not empty successMessage}">
		<script>
			alert("success : ${successMessage}");
		</script>
	</c:when>
	<c:otherwise>
	</c:otherwise>
</c:choose>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Attendance Form</title>
 <link rel="stylesheet" href="css/jquery-ui-1.8.23.custom.css"/>
 	<style>
		div.ui-datepicker{
			font-size:12px;
		}
	</style>
 <script src="js/jquery-1.8.0.js"></script>
 <script src="js/jquery-ui-1.8.23.custom.js"></script>
  
</head>

<body>
<h2 align="center"> Student  Attendance Form</h2>		
<form:form id="form1" name="form1" method="post" action="saveattendance.htm" modelAttribute="attendanceFormModel">
 
  <table width="400" border="0" align="center" cellpadding="5" id="example" >
    <tr>
      <td valign="middle">Date:</td>
      <td><label>
        <form:input type="text" name="date" id="date"  path="date" readonly="true"/>
      </label></td>
      <td>Hour: </td>
      <td><form:select name="hour" id="hour" onChange="" path="hour">
        <option value="1">I</option>
        <option value="2">II</option>
        <option value="3">III</option>
        <option value="4">IV</option>
        <option value="5">V</option>
        <option value="6">VI</option>
        <option value="7">VII</option>
      </form:select></td>
      <td><label>Subject:</label></td>
      <td><form:input type="text" name="subject" id="subject" path="subject"/></td>
      <td>Faculty: </td>
      <td><label>
        <form:input type="text" name="faculty" id="faculty" path="faculty"/>
      </label></td>
    </tr>
  </table>
  <table width="762" border="1" align="center" cellpadding="5" id="attendancetable">
    <tr>
      <th width="50" scope="col">S.No</th>
      <th width="207" scope="col">Hallticket Number</th>
      <th width="185" scope="col">Name</th>
      <th width="324" scope="col">Attendence</th>
    </tr>
    <c:forEach items="${studentList}" var="student" varStatus="i">
	  
	    <tr>
	    	<td align="center">
	    		${i.count}
	    	</td>
	      <td align="center">
		      <input type="hidden" name="attendanceList[${i.count}].id.student.htno" value="${student.htno}">
		      ${student.htno}
		  </td>
	      <td align="justify">${student.name} </td>
	      <td align="center">
	      	<div id="radio" >
	            <form:radiobutton path="attendanceList[${i.count}].attendance" value="P" checked="checked"/> P &nbsp;&nbsp;
	            <form:radiobutton path="attendanceList[${i.count}].attendance" value="A"/> A
	            
			</div>
	       </td>
	    </tr>
    </c:forEach>
    <tr>
	    	<td colspan="5" align="center">
	    		<input type="submit" value="Save Attendance" id="save_attendance">
	       </td>
	    </tr>
   
  </table>
  <p>&nbsp;</p>
  
</form:form>

<script type="text/javascript">
	$(function() {
		
		$("#date").datepicker({ dateFormat: "dd-mm-yy","showAnim":"slide" });
	});
	$("#attendancetable").addClass("ui-widget-content");
	$("#attendancetable th").addClass("ui-widget-header");
	$( "input:submit" ).button();
	$("h2").addClass("ui-widget-header");
	
	
</script>

</body>
</html>
